package com.fitness.fitness.service.impl;

import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fitness.fitness.convertor.MemberConvertor;
import com.fitness.fitness.mapper.MemberMapper;
import com.fitness.fitness.modal.member.dto.MemberDto;
import com.fitness.fitness.modal.member.entity.Member;
import com.fitness.fitness.modal.member.param.MemberPageQueryParams;
import com.fitness.fitness.modal.member.param.MemberQueryParams;
import com.fitness.fitness.modal.member.vo.MemberVO;
import com.fitness.fitness.service.IMemberService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.Map;
import java.util.function.Function;

@Service
@RequiredArgsConstructor
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements IMemberService {

    private final MemberConvertor memberConvertor;

    @Override
    public boolean register(String username, String password, String mobilePhone) {
        return false;
    }

    @Override
    public Member findByMobile(String uuid, String mobile) {
        return null;
    }

    @Override
    public Boolean resetByMobile(String uuid, String password) {
        return null;
    }

    @Override
    public Member editOwn(MemberDto memberEditDTO) {
        return null;
    }

    @Override
    public void logout() {
        StpUtil.logout();
    }

    @Override
    public Member modifyPass(String password, String newPassword) {
        return null;
    }

    @Override
    public IPage<MemberVO> getMemberPage(MemberQueryParams queryParams) {
        return null;
    }

    @Override
    public Boolean forbidden(Long memberId, Boolean diable) {
        return null;
    }

    @Override
    public Boolean resetPass(Long memberId, String newPassword) {
        return null;
    }

    @Override
    public Page<MemberVO> getUserPage(MemberPageQueryParams queryParams) {
        // 参数构建
        int pageNum = queryParams.getPageNum();
        int pageSize = queryParams.getPageSize();
        Page<Member> page = new Page<>(pageNum, pageSize);

        // 查询数据
        Page<Member> userBoPage = this.baseMapper.getMemberPage(page, queryParams);

        return memberConvertor.entity2Vo(userBoPage);
    }

    @Override
    public boolean saveBatch(Collection<Member> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdateBatch(Collection<Member> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean updateBatchById(Collection<Member> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdate(Member entity) {
        return false;
    }

    @Override
    public Map<String, Object> getMap(Wrapper<Member> queryWrapper) {
        return null;
    }

    @Override
    public <V> V getObj(Wrapper<Member> queryWrapper, Function<? super Object, V> mapper) {
        return null;
    }

    @Override
    public Class<Member> getEntityClass() {
        return null;
    }
}
